package com.hiabr.iep.common.web.exception;

import com.hiabr.iep.common.domain.vo.resp.ErrorType;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Description 自定义异常基类
 */
@Data
@NoArgsConstructor
public class BaseException extends RuntimeException {

    private String code;

    public BaseException(String code, String message) {
        super(message);
        this.code = code;
    }

    public BaseException(String message, Throwable cause, String code) {
        super(message, cause);
        this.code = code;
    }

    public BaseException(Throwable cause, String code) {
        super(cause);
        this.code = code;
    }

    public BaseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, String code) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.code = code;
    }

    public BaseException(String message) {
        super(message);
    }


    public BaseException(ErrorType errorType) {
        super(errorType.getMsg());
        this.code = errorType.getCode();
    }
}
